﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - WorkFlowCore.BusinessDemo.Web</title>
    <script type="importmap"></script>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <style>
        html{
            overflow: hidden; /* 防止水平滚动 */
        }
        body {
            overflow-x: hidden; /* 防止水平滚动 */
        }
        header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 28px; /* 减半高度 */
            z-index: 1030;
            background-color: white;
        }
        .page-container {
            margin-top: 28px; /* 为固定的顶部导航栏留出空间，减半 */
            display: flex;
            height: calc(100vh - 28px); /* 减去顶部导航栏的高度，减半 */
        }
        .sidebar-container {
            width: 16.666667%; /* 对应col-md-2的宽度 */
            position: fixed;
            top: 28px; /* 减半高度 */
            bottom: 0;
            background-color: #f8f9fa; /* bg-light的颜色 */
            overflow-y: auto; /* 如果菜单内容过多，允许菜单滚动 */
            z-index: 1020;
        }
        .sidebar {
            height: 100%;
            width: 100%;
        }
        .main-container {
            flex: 1;
            margin-left: 16.666667%; /* 对应col-md-2的宽度 */
            height: 100%;
            overflow-y: hidden; /* 不允许主容器滚动 */
        }
        .main-content {
            padding: 20px;
            height: 100%;
            overflow-y: auto; /* 只允许内容区域滚动 */
        }
        .nav-link.active {
            background-color: #0d6efd;
            color: white !important;
        }
    </style>
</head>
<body>
    <header class="bg-white border-bottom">
        <div class="container-fluid d-flex justify-content-between align-items-center" style="height: 100%;">
            <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">业务系统Demo</a>
            <div class="d-flex align-items-center">
                @if (ViewContext.HttpContext.User.Identity.IsAuthenticated)
                {
                    <span class="nav-link text-dark me-2">欢迎, @ViewContext.HttpContext.User.Identity.Name</span>
                    <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Logout">登出</a>
                }
                else
                {
                    <a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Login">登录</a>
                }
            </div>
        </div>
    </header>
    
    <div class="page-container">
        <div class="sidebar-container">
            <div class="sidebar">
                <nav class="nav flex-column">
                   
                    <div class="nav-item">
                        <a class="nav-link text-dark">
                            <i class="fas fa-sitemap me-2"></i>组织架构
                        </a>
                        <div>
                            <div class="nav flex-column ps-4">
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "User" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-area="" asp-controller="User" asp-action="Index">用户管理</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "Role" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-area="" asp-controller="Role" asp-action="Index">角色管理</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "Organization" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-area="" asp-controller="Organization" asp-action="Index">组织管理</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "UserSelectApiDoc" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-controller="UserSelectApiDoc" asp-action="Index">用户选择接口文档</a>
                            </div>
                        </div>
                    </div>
                    <div class="nav-item">
                        
                    </div>
                    <div class="nav-item">
                        <a class="nav-link text-dark">
                            <i class="fas fa-sync-alt me-2"></i>任务状态同步
                        </a>
                        <div>
                            <div class="nav flex-column ps-4">
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "WorkTaskStateInfo" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-area="" asp-controller="WorkTaskStateInfo" asp-action="Index">工作任务状态</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "WorkTaskStateInfo" && ViewContext.RouteData.Values["Action"]?.ToString() == "ApiDoc" ? "active" : "")" asp-controller="WorkTaskStateInfo" asp-action="ApiDoc">状态同步API文档</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "WorkTaskStateInfo" && ViewContext.RouteData.Values["Action"]?.ToString() == "SyncAllStatesDoc" ? "active" : "")" asp-controller="WorkTaskStateInfo" asp-action="SyncAllStatesDoc">同步所有状态文档</a>
                           </div>
                        </div>
                    </div>
                    <div class="nav-item">
                        <a class="nav-link text-dark">
                            <i class="fas fa-stamp me-2"></i>业务流程
                        </a>
                        <div>
                            <div class="nav flex-column ps-4">
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "OfficialSealApplication" && ViewContext.RouteData.Values["Action"]?.ToString() == "Index" ? "active" : "")" asp-area="" asp-controller="OfficialSealApplication" asp-action="Index">公章申请</a>
                            </div>
                        </div>
                    </div>
                    <div class="nav-item">
                        <a class="nav-link text-dark">
                            <i class="fas fa-key me-2"></i>身份认证
                        </a>
                        <div>
                            <div class="nav flex-column ps-4">
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "Account" && ViewContext.RouteData.Values["Action"]?.ToString() == "ApiDoc" ? "active" : "")" asp-controller="Account" asp-action="ApiDoc">身份验证接口文档</a>
                                <a class="nav-link text-dark @(ViewContext.RouteData.Values["Controller"]?.ToString() == "Account" && ViewContext.RouteData.Values["Action"]?.ToString() == "AutoLogin" ? "active" : "")" asp-controller="Account" asp-action="AutoLogin">自动登录演示</a>
                            </div>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
        <div class="main-container">
            <div class="main-content">
                @RenderBody()
            </div>
        </div>
    </div>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            if (!@Json.Serialize(ViewContext.HttpContext.User.Identity.IsAuthenticated)) {
                var loginUrl = '@Url.Action("Login", "Account")';
                if (window.location.pathname !== loginUrl) {
                    window.location.href = loginUrl;
                }
            }
        });
    </script>
</body>
</html>
